#include <iostream>
using namespace std;

class Point{
public:
    Point():x(0),y(0){
        count++;
        cout<<"Default Constructor called."<<endl;
    }
    Point(int x, int y):x(x),y(y){
        count++;
        cout<<"Constructor called."<<endl;
    }
    Point(const Point &p):x(p.x),y(p.y){
        count++;
        cout<<"Copy constructor called."<<endl;
    }
    ~Point(){cout<<"Destructor called."<<endl;count--;}
    int getX() const{return x;}
    int getY() const{return y;}
    void move(int newX, int newY){
        x=newX;
        y=newY;
    }
    void print(){cout<<"x="<<x<<"\ty="<<y<<endl;}
    static int count;
private:
    int x,y;
};

class arrayOfPoints{
public:
    arrayOfPoints(int size):size(size){
        points=new Point[size];// Point *points=new Point[size];
    }
    ~arrayOfPoints(){
        cout<<"Deleting..."<<endl;
        delete[] points;
    }
    Point *element(int index){
    	Point *p=&points[index];
        return p;
    }
    
private:
    int size;
    Point *points;
};

int Point::count=0;
int main() {
    arrayOfPoints u(2);
    u.element(0)->move(11,12);
    (*u.element(0)).print();
    return 0;
}


